<template>
    <div>
        <span>当前经纬度</span>
        <span>当前经纬度</span>
        <van-button size="small" @click="getLocation">获取经纬度</van-button>
        <van-button size="small" @click="optionmap">打开地图</van-button>
        <van-button size="small" @click="openAddress">获取地址</van-button>
    </div>
</template>

<script>

export default {
  data () {
    return {
      latitude: '',
      longitude: ''
    }
  },
  mounted () {
    this.$common.share({
      title: '你好',
      link: 'http://hdcitycard.tripln.top/#/demo/wxdemo',
      desc: '你好描述',
      imgurl: 'https://skv4.oss-cn-hangzhou.aliyuncs.com/cityCard/zw/6-01.png',
      success: function () {

      }
    })
  },
  methods: {
    // --获取经纬度
    getLocation () {
      this.$common.getLocation(function (option) {
        console.log(option)
      })
    },
    optionmap () {
      this.$common.openLocation({
        latitude: 41.910786, // 纬度，浮点数，范围为90 ~ -90
        longitude: 123.398285, // 经度，浮点数，范围为180 ~ -180。
        name: '华强城', // 位置名
        address: '沈北新区华强城', // 地址详情说明
        url: 'http://www.baidu.com'
      })
    },
    openAddress () {
      this.$common.openAddress(function (ret) {
        alert(JSON.stringify(ret))
      })
    }
  }
}
</script>

<style scoped>

</style>
